package tq.com.tqcom.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.TextView;

import tq.com.tqcom.R;


public class TQHeader5View extends FrameLayout {


    protected ImageButton backIcon;
    protected TextView titleView;
    protected TextView rightView;

    public TQHeader5View(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initUI();
    }

    protected void initUI(){
        LayoutInflater.from(getContext()).inflate(R.layout.view_header5_layout, this);

        backIcon = findViewById(R.id.back_icon);
        titleView = findViewById(R.id.title_content);
        rightView = findViewById(R.id.right);

        initBack(backIcon);
        initTitle(titleView);
        initRightView(rightView);
    }

    protected void initBack(ImageButton pBackIcon){

    }
    protected void initTitle(TextView pTitleView){

    }

    protected void initRightView(TextView pRightView){

    }

    public void setBackIconClickListener(OnClickListener pBackIconClickListener){
        backIcon.setOnClickListener(pBackIconClickListener);
    }
    public void setRightViewClickListener(OnClickListener pRightViewClickListener){
        rightView.setOnClickListener(pRightViewClickListener);
    }

    public ImageButton getBackIcon() {
        return backIcon;
    }

    public TextView getTitleView() {
        return titleView;
    }

    public TextView getRightView() {
        return rightView;
    }
}
